'''
媒体库查询接口：

'''
import allure
import requests
import conftest
from common.logger import Log

@allure.feature('媒体库模块')
class Test_getMedia():

    def setup_method(self):
        # 定义登录接口URL地址
        self.getMediaPage_url = "http://192.168.3.182:9990/airservice-device/media/getMediaPage"
        self.log = Log("查询媒体库接口").get_logger()


    # case01 查询媒体库接口
    @allure.step(title="查询媒体库接口")
    def test_getMediaPage_case01(self):

        self.getMediaPage_data = {
                            "startTime": "2023-03-31 00:00:00",
                            "endTime": "2023-03-31 23:59:59",
                            "fileType": None,
                            "jobName": None,
                            "favorited": "",
                            "regionCodeList": [],
                            "pageNum": 1,
                            "pageSize": 10
                            }

        response = requests.post(url=self.getMediaPage_url, json=self.getMediaPage_data, headers=conftest.headers_data)

        #添加断言
        assert response.json().get("message") == "success"
        assert  response.json().get("success") == True

        self.log.info("{}".format(response.json()))

